import { HTTP } from "../utils/http.js";

class OrderModule extends HTTP {
	orderAnPlace(id, stock) {
		return this.request({
			url: 'order/add',
			method: 'POST',
			data: {
				id,
				stock
			}
		})
	}
	
	orderPay(id) {
		return this.request({
			url: 'order/pay',
			method: 'POST',
			data: {
				id
			}
		})
	}
	
	getOrderList(type, page) {
		return this.request({
			url: 'order/list',
			method: 'GET',
			data: {
				type,
				page: page + 1
			}
		})
	}
	
	getOrderDetail(id) {
		return this.request({
			url: 'order/detail',
			data: {
				id
			}
		})
	}
	// 完成订单
	getUpData(id) {
		return this.request({
			url: 'order/update',
			data: {
				id
			}
		})
	}
}

module.exports =  new OrderModule()